package com.dexgdx.game.structure.projectile;

import com.badlogic.gdx.graphics.g2d.ParticleEffectPool.PooledEffect;
import com.dexgdx.game.Game;
import com.dexgdx.game.constants.EParticleType;
import com.dexgdx.game.structure.base.BasePoint;

public class PooledEffectWrapper {
	
	BasePoint position;
	PooledEffect pooledEffect;
	
	EParticleType eParticleType;
	boolean yFlipped;
	
	public PooledEffectWrapper(PooledEffect pooledEffect, EParticleType eParticleType) {
		super();
		this.position = new BasePoint();
		this.pooledEffect = pooledEffect;
		this.eParticleType = eParticleType;
		if(eParticleType == EParticleType.TRAIL){
			this.pooledEffect.flipY();
			yFlipped = true;
		}
	}
	
	public PooledEffectWrapper() {
		super();
		this.position = new BasePoint();
	}

	public void setPosition(float x, float y){
		position.x = x;
		position.y = y;
	}
	
	public void setPooledEffect(PooledEffect pooledEffect){
		this.pooledEffect = pooledEffect;
		if(eParticleType == EParticleType.TRAIL && !yFlipped){
			this.pooledEffect.flipY();
		}
	}
	
	public PooledEffect getPooledEffectMapRel(){
		pooledEffect.setPosition(position.x + Game.initialMultiTouchPosition.x, position.y + Game.initialMultiTouchPosition.y);
		return pooledEffect;
	}
	
	public boolean isComplete(){
		return pooledEffect.isComplete();
	}
	
}
